package com.infolab.aims.domain.asset;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.infolab.aims.common.bean.AbstractModelBean;
import com.infolab.aims.domain.Location;

@Entity
@Table(name="AMTB_ASSET_BALANCE_ITEM")
public class AssetBalanceItem extends AbstractModelBean implements Serializable {
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer assetBalanceItemId;
	
	@ManyToOne
	@JoinColumn(name="assetBalanceId")
	private AssetBalance assetBalance;
	
	private String companyCode;
	
	private String quantityOnHand;
	
	@ManyToOne
	@JoinColumn(name="assetModelId")
	private AssetModel assetModel;

	private String assetType;

	private Float unitPrice;
	
	private Integer vendorId;
	
	@ManyToOne
	@JoinColumn(name="locationId")
	private Location location;
	
	public AssetBalanceItem(Long total, Integer assetModelId, String  companyCode, Integer locationId, String asssetType){
		AssetModel assetModel = new AssetModel();
		assetModel.setAssetModelId(assetModelId);
		Location location = new Location();
		location.setLocationId(locationId);
		this.assetModel = assetModel;
		this.location = location;
		this.quantityOnHand = total.toString();
		this.companyCode = companyCode;
		this.assetType = asssetType;
	}
	
	public AssetBalanceItem(Long quantityOnHand, Float price, Integer assetModelId, Integer locationId, String companyCode, String asssetType){
		AssetModel assetModel = new AssetModel();
		assetModel.setAssetModelId(assetModelId);
		Location location = new Location();
		location.setLocationId(locationId);	
		
		this.quantityOnHand = quantityOnHand.toString();
		this.companyCode = companyCode;
		this.unitPrice = (price == null ? 0 : price);
		this.location = location;
		this.assetModel = assetModel;
		this.assetType = asssetType;
	}
	 
	public AssetBalanceItem() {
	}

	public Integer getAssetBalanceItemId() {
		return assetBalanceItemId;
	}

	public void setAssetBalanceItemId(Integer assetBalanceItemId) {
		this.assetBalanceItemId = assetBalanceItemId;
	}

	public AssetBalance getAssetBalance() {
		return assetBalance;
	}

	public void setAssetBalance(AssetBalance assetBalance) {
		this.assetBalance = assetBalance;
	}

	public String getCompanyCode() {
		return companyCode;
	}

	public void setCompanyCode(String companyCode) {
		this.companyCode = companyCode;
	}

	public String getQuantityOnHand() {
		return quantityOnHand;
	}

	public void setQuantityOnHand(String quantityOnHand) {
		this.quantityOnHand = quantityOnHand;
	}

	public AssetModel getAssetModel() {
		return assetModel;
	}

	public void setAssetModel(AssetModel assetModel) {
		this.assetModel = assetModel;
	}

	public Float getUnitPrice() {
		return unitPrice;
	}

	public void setUnitPrice(Float unitPrice) {
		this.unitPrice = unitPrice;
	}

	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
	}

	public Integer getVendorId() {
		return vendorId;
	}

	public void setVendorId(Integer vendorId) {
		this.vendorId = vendorId;
	}

	public String getAssetType() {
		return assetType;
	}

	public void setAssetType(String assetType) {
		this.assetType = assetType;
	}
	
	
}
